#include <vector>
using namespace std;
#include <set>
#include <algorithm>


// version 1 
class Solution {
public:
//找极大值！
    int findPeakElement(vector<int>& nums) {
        int left = 0, right = nums.size() - 1;
        while(left < right){
            int mid = left + (right - left + 1) / 2;
            if(nums[mid - 1] < nums[mid]) left = mid;
            else right = mid - 1;
        }
        return left;
    }
};